<cfcomponent displayname="Controller" extends="ModelGlue.unity.controller.Controller" output="false">
	<!--- 
		Any function set up to listen for the onRequestStart message happens before any of the <event-handlers>.
		This is a good place to put things like session defaults.
	--->
	<cffunction name="init" access="public" returntype="controller" output="false">
		<cfargument name="ModelGlue" required="true" type="ModelGlue.ModelGlue" />
		<cfargument name="instanceName" required="true" type="string" />
		<cfset var modelPath = "snipex.model" />
		<cfset var facadePath = "snipex.facades" />
		
		<cfset super.Init(arguments.ModelGlue) />
		
		<cfset variables.appConfig = GetModelGlue().GetBean("siteConfiguration").getConfig() />		
		<cfset variables.userFacade = createobject("component", facadePath & ".userFacade") />
		<cfreturn this>		
	</cffunction>
	
	<cffunction name="onRequestStart" access="public" returnType="void" output="false">
		<cfargument name="event" type="any">
		
	</cffunction>

	<!--- 
		Any function set up to listen for the onQueueComplete message happens after all event-handlers are
		finished running and before any views are rendered.  This is a good place to load constants (like UDF
		libraries) that the views may need.
	--->
	<cffunction name="onQueueComplete" access="public" returnType="void" output="false">
	  <cfargument name="event" type="any">
	</cffunction>
	
	<cffunction name="doLogin" access="public" returntype="void" output="false">
		<cfargument name="event" type="any"/>
		<cfif variables.sessionFacade.getLoginStatus() is false>
			<cfset variables.sessionFacade.setLoginStatus(true)>			
		</cfif>
		<cfset arguments.event.setValue("isLoggedIn",variables.sessionFacade.getLoginStatus()) />
		<cfset arguments.event.addResult("success") />
	</cffunction>
	<!--- 
		Any function set up to listen for the onRequestStart message happens after views are rendered.
	--->
	<cffunction name="onRequestEnd" access="public" returnType="void" output="false">
	  <cfargument name="event" type="any">
	</cffunction>
</cfcomponent>